<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=utf-8" pageEncoding="utf-8"
         language="java" %>
<%@ include file="/jsp/platform/include/include.jsp" %>
<html>
<head>
    <TITLE><c:out value="${_LOGONUSER_.MANAGETITILE}"/></TITLE>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <%@ include file="/jsp/platform/include/header.jsp" %>

</head>
<BODY>
<DIV class="all">
    <%@ include file="/jsp/platform/include/head.jsp" %>
    <%@ include file="/jsp/platform/include/menu.jsp" %>
    <DIV class="mains">
        <TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
            <TBODY>
            <TR valign="top">
                <%@ include file="/jsp/platform/include/mainLeft.jsp" %>
                <TD>
                    <TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
                        <TBODY>
                        <TR>
                            <TD>
                                <TABLE width="180" border="0" cellspacing="0" cellpadding="0">
                                    <TBODY>
                                    <TR>
                                        <TD width="7"><IMG width="7" height="36" alt=""
                                                           src="<%=request.getContextPath()%>/images/pages_l.jpg">
                                        </TD>
                                        <TD align="center"
                                            background="<%=request.getContextPath()%>/images/pages_bg.jpg">
                                            <SPAN class="f_tit1">代理商查询</SPAN></TD>
                                        <TD width="7"><IMG width="7" height="36" alt=""
                                                           src="<%=request.getContextPath()%>/images/pages_r.jpg">
                                        </TD>
                                    </TR>
                                    </TBODY>
                                </TABLE>
                            </TD>
                        </TR>
                        </TBODY>
                        <TR>
                            <TD>
                                <div class="pages_con">
                                    <FORM name="queryForm" id="queryForm"
                                          action="<%=request.getContextPath()%>/manage/agentInfo/queryAgentList"
                                          method="post">
                                        <div class="pages_con_20">

                                            <div class="transaction_external">
                                                <DIV class="clearfix">
                                                            <SPAN class="label dl_w"
                                                                  style="padding-left:20px;text-align:right;">开户时间：</SPAN>
                                                            <DIV class="select2 date">
                                                                <INPUT name="beginDate" class="easyui-datebox"
                                                                       id="beginDate" style="border:none" type="text"
                                                                       data-options="formatter:myformatter,parser:myparser"
                                                                       value="${model.beginDate}">
                                                            </DIV>
                                                            <SPAN class="label margin_l_5">-</SPAN>
                                                            <DIV class="select2 date">
                                                                <INPUT name="endDate" class="easyui-datebox"
                                                                       id="endDate" style="border:none" type="text"
                                                                       data-options="formatter:myformatter,parser:myparser"
                                                                       value="${model.endDate}">
                                                            </DIV>

                                                            <SPAN class="fund-item"><SPAN class="label dl_w"
                                                                  style="padding-left:20px;text-align:right;">代理商名称：</SPAN>
                                                                  <INPUT name="agentName" id="agentName"
                                                                         class="txtbox_cz txtbox_cz_long txtbox_cz_color input_change"
                                                                         type="text" maxlength="30"
                                                                         value="<c:out value='${model.agentName}'/>"/>
                                                            </SPAN>

															<SPAN class="fund-item"><SPAN class="label dl_w"
                                                                  style="padding-left:20px;text-align:right;">系统账号：</SPAN>
																  <INPUT name="sysAccount" id="sysAccount"
                                                                               class="txtbox_cz txtbox_cz_long txtbox_cz_color input_change"
                                                                               type="text" maxlength="30"
                                                                               value="<c:out value='${model.sysAccount}'/>"/>
                                                            </SPAN>
                                                </DIV>
                                                <DIV class="clearfix">
															<SPAN class="fund-item">
                                                                <SPAN class="label dl_w"
                                                                  style="padding-left:20px;text-align:right;">代理等级</SPAN>
															<select id="agentLevel" name="agentLevel">
																<option value="">请选择</option>
                                                                <c:forEach var="roleModel" items="${roleList}">
                                                                    <option value="${roleModel.roleId}">${roleModel.roleName}</option>
                                                                </c:forEach>
														    </select>
                                                            </SPAN>
														    <SPAN class="fund-item"><SPAN class="label dl_w"
                                                                  style="padding-left:20px;text-align:right;">代理类型</SPAN>
															<select id="agentType" name="agentType" value="<c:out value='${model.agentType}'/>">
                                                                <option value="">请选择</option>
                                                                <option value="1">个人</option>
                                                                <option value="2">企业</option>
														    </select>
                                                            </SPAN>
                                                                <SPAN class="fund-item"><SPAN class="label dl_w"
                                                                  style="padding-left:20px;text-align:right;">合约到期</SPAN>
															<select id="isOverDate" name="isOverDate" value="<c:out value='${model.isOverDate}'/>">
                                                                <option value="">请选择</option>
                                                                <option value="1">即将到期</option>
                                                                <option value="2">已到期</option>
														    </select>
                                                            <SPAN class="label dl_w" style="padding-left:50px;">直属代理
                                                            <input type="checkbox" id="isDirect" name="isDirect" value="1"
                                                            <c:if test="${model.isDirect=='1'}">checked="true"</c:if>></SPAN>

                                                            <SPAN class="fund-item"> <A class="btn confirm margin_l_10" onClick="$('#queryForm').submit();"
                                                                  href="javascript:void(0);">查询</A> </SPAN>
                                                            </SPAN>
                                                </DIV>

                                            </DIV>
                                            <br>

                                            <div class="talbes">

                                                <table style="text-align: center" width="100%" border="0"
                                                       cellpadding="8" cellspacing="0">
                                                    <tbody>
                                                    <tr class="talbe_pubs_tr">
                                                        <td>开户时间</td>
                                                        <td>代理名称</td>
                                                        <td>系统账号</td>
                                                        <td>运营起始</td>
                                                        <td>运营终止</td>
                                                        <td>代理等级</td>
                                                        <td>操作</td>
                                                    </tr>
                                                    <c:forEach var="agentInfoModel" items="${agentInfoList}">
                                                        <tr>
                                                            <td><fmt:formatDate value="${agentInfoModel.createDate}"
                                                                                pattern="yyyy-MM-dd HH:mm:ss"/>
                                                            </td>
                                                            <td>${agentInfoModel.agentName}</td>
                                                            <td>${agentInfoModel.sysAccount}</td>

                                                            <td><fmt:formatDate value="${agentInfoModel.bussBegindate}"
                                                                                pattern="yyyy-MM-dd"/></td>
                                                            <td><fmt:formatDate value="${agentInfoModel.bussEnddate}"
                                                                                pattern="yyyy-MM-dd"/></td>
                                                            <td>
                                                                <c:forEach var="roleModel" items="${roleList}">
                                                                    <c:if test="${agentInfoModel.agentLevel ==roleModel.roleId}">${roleModel.roleName}</c:if>
                                                                </c:forEach>

                                                            </td>
                                                            <td><a onclick="editAgentInfo('<c:out value="${agentInfoModel.agentId}" />')"  href="javascript:" value="${agentInfoModel.agentId}">修改</a>
                                                                <a onclick="resetPwd('<c:out value="${agentInfoModel.sysAccount}" />')"  href="javascript:" value="${agentInfoModel.sysAccount}">密码重置</a>
                                                                <a onclick="closeAgent('<c:out value="${agentInfoModel.agentId}" />')"  href="javascript:" value="${agentInfoModel.agentId}">关闭</a>
                                                            </td>
                                                        </tr>
                                                    </c:forEach>
                                                    </tbody>
                                                </table>
                                                <jsp:include page="/jsp/platform/include/kkpager.jsp"></jsp:include>
                                            </div>
                                        </div>
                                    </FORM>
                                </div> <!--当中内容块结束--></TD>
                        </TR>
                    </TABLE>
                </TD>
            </TR>
            </TBODY>
        </TABLE>
    </DIV>
    <%@ include file="/jsp/platform/include/foot.jsp" %>
        <script type="text/javascript">
            //这句放到页面最后 edit by wenjw 2015.6.2
            $("#agentType").val("<c:out value='${model.agentType}'/>");
            $("#agentLevel").val("<c:out value='${model.agentLevel}'/>");
            $("#isOverDate").val("<c:out value='${model.isOverDate}'/>");

            <!--编辑代理-->
            function editAgentInfo(agentId) {
                    window.location.href = URL_BASE+'/manage/agentInfo/queryAgentInfoPage?menuType=50&menuId=501010&agentId=' + agentId;
            };

            <!--关闭代理-->
            function closeAgent(agentId){

                $.messager.confirm("操作提示", "您确定要关闭吗！", function (data) {
                    if (data) {
                        var url = URL_BASE + '/manage/agentInfo/closeAgent';
                        var dataParam={
                            'agentId': agentId
                        };

                        $.ajax({
                            type: "post",
                            url : url,
                            data : dataParam,
                            beforeSend : function(XMLHttpRequest) {},
                            success : function(data) {
                                showMessage(data.msg);
                            },
                            error : function(data) {
                                // 请求出错处理
                                showNetErrorMessage("");
                            }
                        });

                    }
                })
            };


            function resetPwd(sysAccount) {
                debugger;
                $.messager.confirm("操作提示", "您确定要执行此操作吗！", function (data) {
                    if (data) {
                        var url = URL_BASE + '/manage/agentInfo/resetPwd';
                        var dataParam={
                            'sysAccount': sysAccount
                        };

                        $.ajax({
                            type: "post",
                            url : url,
                            data : dataParam,
                            beforeSend : function(XMLHttpRequest) {},
                            success : function(data) {
                                $.messager.alert(
                                    "提示信息",
                                    data.msg);
                            },
                            error : function(data) {
                                // 请求出错处理
                                $.messager.alert(
                                    "提示信息",
                                    data.msg);
                            }
                        });

                    }
                })
            };

        </script>
</BODY>
</HTML>
